package com.shsh.safemanage.model;

import java.util.Comparator;

final public class WeakUserReportComparatorByPointSum implements Comparator<WeakUserReport> {
	private static WeakUserReportComparatorByPointSum instance;

	public static Comparator<WeakUserReport> getInstance() {
		if (instance == null) {
			instance = new WeakUserReportComparatorByPointSum();
		}
		return instance;
	}

	private WeakUserReportComparatorByPointSum() {

	}

	public int compare(WeakUserReport o1, WeakUserReport o2) {
		int compare = o2.getPointSum() - o1.getPointSum();
		if (compare == 0) {
			compare = o2.getUserID().intValue() - o1.getUserID().intValue();
		}

		return compare;
	}
}
